package com.egg.ylt.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.egg.ylt.R;
import com.egg.ylt.pojo.UserPhotoListEntity;
import com.egg.ylt.presenter.impl.PhotoBrowserPresenter;
import com.egg.ylt.widget.imagepicker.ImagesDataHolder;
import com.yonyou.framework.library.adapter.rv.CommonAdapter;
import com.yonyou.framework.library.adapter.rv.ViewHolder;

/**
 * Created By Dlx
 * on 2019/3/3
 */
public class ADA_UserPhotoListAdapter extends CommonAdapter<UserPhotoListEntity.ListBean> {
    private PhotoBrowserPresenter mPresenter;

    public ADA_UserPhotoListAdapter(Context context, PhotoBrowserPresenter mPresenter) {
        super(context);
        this.mPresenter = mPresenter;
    }

    @Override
    protected int itemLayoutId() {
        return R.layout.item_photobrowser;
    }

    @Override
    protected void convert(ViewHolder holder, final UserPhotoListEntity.ListBean listBean, final int position) {
        Glide.with(mContext).load(listBean.getImageUrl()).placeholder(R.drawable.icon_picloading).into((ImageView) holder.getView(R.id.item_photobrowser_pic));
        holder.setOnClickListener(R.id.item_photobrowser_pic, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ImagesDataHolder.getInstance().holdeEntityList(mDatas);
                mPresenter.jumpToMultiPics(position);
            }
        });
    }
}
